// pages/note/note.js
Page({
  data: {
    content: '',
    currentDate: ''
  },

  onLoad() {
    // 加载当前日期
    const date = new Date();
    const dateStr = `${date.getFullYear()}-${(date.getMonth()+1).toString().padStart(2,'0')}-${date.getDate().toString().padStart(2,'0')}`;
    
    // 从缓存加载内容
    const content = wx.getStorageSync('quick_note') || '';
    
    this.setData({
      currentDate: dateStr,
      content
    });
  },

  // 输入处理
  onInput(e) {
    this.setData({
      content: e.detail.value
    });
  },

  // 保存到缓存
  saveNote() {
    wx.setStorageSync('quick_note', this.data.content);
    wx.showToast({
      title: '已保存',
      icon: 'success',
      duration: 1500
    });
  }
});